
<body>
    <div class="bg"></div>
    <div class="container">
        <div class="line bouncein">
            <div class="xs6 xm4 xs3-move xm4-move">
                <div style="height:150px;"></div>
                <div class="media media-y margin-big-bottom">           
                </div>         
                <div>
                    <div class="panel loginbox">
                        <div class="text-center margin-big padding-big-top"><h1>千变计划管理中心</h1></div>
                        <div class="panel-body" style="padding:30px; padding-bottom:10px; padding-top:10px;">
                            <div class="form-group">
                                <div class="field field-icon-right">
                                    <input type="text" class="input input-big" name="name" placeholder="登录账号" data-validate="required:请填写账号"  id="username"/>
                                    <span class="icon icon-user margin-small"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="field field-icon-right">
                                    <input type="password" class="input input-big" name="password" placeholder="登录密码" data-validate="required:请填写密码" id="password" />
                                    <span class="icon icon-key margin-small"></span>
                                </div>
                            </div>
                        </div>
                        <div style="padding:30px;"><input type="submit" class="button button-block bg-main text-big input-big" value="登录" id="loginBtn"></div>
                    </div>
                    </form>          
                </div>
            </div>
        </div>
</body>
</html>
<script>
    $("#loginBtn").click(function () {
        let username = $("#username").val();
        let password = $("#password").val();
        let url = "<?= site_url('user/login') ?>";
        let jsonData = {
            'username': username,
            'password': password
        };
        $.post(url, jsonData, function (redata) {
            if (redata.errno == '666') {
                window.location.href = "<?= site_url('home/index') ?>";
            } else {
                alert(redata.error);
            }
        }, 'json');
    })

</script>